﻿package com.findMoneyGame.pages.preloading {
	import flash.display.MovieClip;
	import flash.events.Event;

	import com.findMoneyGame.models.User;
	import com.findMoneyGame.pages.preloading.MainLoadingState;
	
	public class ThePreloader extends MovieClip {
		// события:
		public static const LOAD_COMPLETE = 'loadComplete';
		
		private var fullWidth : Number; //the width of our mcPreloaderBar at 100%
		private var _maxGameLevel : int;
		private var _gameLevels = new Array();

		public function get gameLevels () : Array { return _gameLevels; }
		public function get maxGameLevel () : int { return _maxGameLevel; }
		public function set maxGameLevel (value : int) { _maxGameLevel = value; }


		public function ThePreloader (fullWidth : Number = 0) {
			this.fullWidth = fullWidth;
		}
		public function start () {
			new MainLoadingState(this).start();
		}
		public function complete () {
			// Сделать нормальное завершение прелоадера
			dispatchEvent(new Event(LOAD_COMPLETE));
		}
		public function setPreloadingPercent (percent : Number) {
			mcPreloaderBar.width = percent * fullWidth;
		}
	}
}